package android.app;

import android.app.PendingIntent;
import android.os.Parcel;
import android.os.Parcelable;

public class Popup implements Parcelable {

    private static final String TAG = "Popup";

    private int mId;
	private String mPkg;
    private String mTitle;
    private String mContent;
    private String mActionCancel = "";
    private String mActionCancelText = "";
    private PendingIntent mActionOne = null;
    private String mActionOneText = "";
    private String mActionTwo = "";
    private String mActionTwoText = "";
    private int mIconId = 0;
    private int mPriority = 0;
    private long mTimestamp = System.currentTimeMillis();
    private double mLongitude = -1.0f;
    private double mLatitude = -1.0f;

    public Popup(String title, String content) {
        mTitle = title;
        mContent = content;
    }

    protected Popup(Parcel in) {
		mId = in.readInt();
		mPkg = in.readString();
        mTitle = in.readString();
        mContent = in.readString();
        mActionCancel = in.readString();
        mActionCancelText = in.readString();
        mActionOne = in.readParcelable(PendingIntent.class.getClassLoader());
        mActionOneText = in.readString();
        mActionTwo = in.readString();
        mActionTwoText = in.readString();
        mIconId = in.readInt();
        mPriority = in.readInt();
        mTimestamp = in.readLong();
        mLongitude = in.readDouble();
        mLatitude = in.readDouble();
    }

    public static final Creator<Popup> CREATOR = new Creator<Popup>() {
        @Override
        public Popup createFromParcel(Parcel in) {
            return new Popup(in);
        }

        @Override
        public Popup[] newArray(int size) {
            return new Popup[size];
        }
    };

    /**
        * @hide
        */
    public Popup setId(int id) {
		mId = id;
        return this;
    }

    /**
        * @hide
        */
    public int getId() {
        return mId;
    }

    /**
        * @hide
        */
	public Popup setPackageName(String pkg) {
        mPkg = pkg;
        return this;
    }

    /**
        * @hide
        */
    public String getPackageName() {
        return mPkg;
    }

    public Popup setTitle(String title) {
        mTitle = title;
        return this;
    }

    public String getTitle() {
        return mTitle;
    }

    public Popup setContent(String content) {
        mContent = content;
        return this;
    }

    public String getContent() {
        return mContent;
    }

    public Popup setActionCancel(String text, String action) {
        mActionCancelText = text;
        mActionCancel = action;
        return this;
    }

    public String getActionCancelText() {
        return mActionCancelText;
    }

    public String getActionCancel() {
        return mActionCancel;
    }

    public Popup setActionOne(String text, PendingIntent action) {
        mActionOne = action;
        mActionOneText = text;
        return this;
    }

    public String getActionOneText() {
        return mActionOneText;
    }

    public PendingIntent getActionOne() {
        return mActionOne;
    }

    public Popup setActionTwo(String text, String action) {
        mActionTwo = action;
        mActionTwoText = text;
        return this;
    }

    public String getActionTwoText() {
        return mActionTwoText;
    }

    public String getActionTwo() {
        return mActionTwo;
    }

    public Popup setIcon(int id) {
        mIconId = id;
        return this;
    }

    public int getIcon() {
        return mIconId;
    }

    public Popup setPriority(int priority) {
        mPriority = priority;
        return this;
    }

    public int getPriority() {
        return mPriority;
    }

    /**
        * @hide
        */
    public Popup setTimestamp(long timestamp) {
        mTimestamp = timestamp;
        return this;
    }

	/**
        * @hide
        */
    public long getTimestamp() {
        return mTimestamp;
    }

    public Popup setLongitude(double longitude) {
        mLongitude = longitude;
        return this;
    }

    public double getLongitude() {
        return mLongitude;
    }

    public Popup setLatitude(double latitude) {
        mLatitude = latitude;
        return this;
    }

    public double getLatitude() {
        return mLatitude;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(mId);
        parcel.writeString(mPkg);
        parcel.writeString(mTitle);
        parcel.writeString(mContent);
        parcel.writeString(mActionCancel);
        parcel.writeString(mActionCancelText);
        parcel.writeParcelable(mActionOne, 0);
        parcel.writeString(mActionOneText);
        parcel.writeString(mActionTwo);
        parcel.writeString(mActionTwoText);
        parcel.writeInt(mIconId);
        parcel.writeInt(mPriority);
        parcel.writeLong(mTimestamp);
        parcel.writeDouble(mLongitude);
        parcel.writeDouble(mLatitude);
    }
}

